Remove static buffer (that would never be overflowed) in KML geocache writer.
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 17 Feb 2014 01:58:24 +0000 (01:58 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Mon, 17 Feb 2014 01:58:24 +0000 (01:58 +0000)
git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4747 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/gui/gmapdlg.cc
gpsbabel/kml.cc

index 1c9a0c7b89531ba12628f5bc9eee3425cc979393..cb2bfcfe4692af62e48dcc30ae877460df762d0a 100644 (file)
@@ -145,6 +145,7 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   lay->addWidget(mapWidget_);
 
   model_ = new QStandardItemModel(this);
+  menuIndex_ = -1; // Actually set for real in showContextMenu().
 
   wptItem_ = new StandardItem(tr("Waypoints"));
   wptItem_->setCheckable(true);
@@ -211,7 +212,6 @@ GMapDialog::GMapDialog(QWidget *parent, const QString &gpxFileName, QPlainTextEd
   connect(ui_.copyButton, SIGNAL(clicked()), this, SLOT(copyButtonClickedX()));
 
   ui_.copyButton->hide(); // Hide for now, not working
-
 }
 
 //-------------------------------------------------------------------------
index bcbfdfde374e8dc5148569df8d5ee456ae9131b6..12226cb7f7a697c80726c386a2ca671206212916 100644 (file)
@@ -1395,8 +1395,6 @@ static void kml_write_cdata_element(const QString& name, const QString& value)
 static void kml_geocache_pr(const Waypoint* waypointp)
 {
   char* is;
-  char date_placed[100];  // Always long engough for a date.
-
   const char* issues = "";
 
   writer->writeStartElement("Placemark");
@@ -1412,11 +1410,9 @@ static void kml_geocache_pr(const Waypoint* waypointp)
 
   // Timestamp
   kml_output_timestamp(waypointp);
+  QString date_placed;
   if (waypointp->GetCreationTime().isValid()) {
-    strcpy(date_placed,
-           qPrintable(waypointp->GetCreationTime().toString("dd-MMM-yyyy")));
-  } else {
-    date_placed[0] = '\0';
+    date_placed = waypointp->GetCreationTime().toString("dd-MMM-yyyy");
   }
 
   writer->writeTextElement("styleUrl", "#geocache");